// Copyright (c)  YISH. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System.Collections.Generic;
using NSQL.Expressions;
using NSQL.Generator;

namespace NSQL.Extensions
{
    public static class ExpressionExtensions
    {
        public static IEnumerable<IExpression> AsEnumerable(this IExpression expression)
        {
            return new ExpressionCollector(expression);
        }
        
        public static string ToSql(this IExpression expression)
        {
            return SqlGenerator.Instance.Generate(expression);
        }
        
        public static string ToOracle(this IExpression expression)
        {
            return OracleGenerator.Instance.Generate(expression);
        }
        public static string ToNpgsql(this IExpression expression)
        {
            return NpgsqlGenerator.Instance.Generate(expression);
        }
        
        public static string ToMySql(this IExpression expression)
        {
            return MySqlGenerator.Instance.Generate(expression);
        }
                
        public static string ToSqlServer(this IExpression expression)
        {
            return SqlServerGenerator.Instance.Generate(expression);
        }
        
        public static string ToSQLite(this IExpression expression)
        {
            return SQLiteGenerator.Instance.Generate(expression);
        }
    }
}